using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using IGlobalist.Cms.Common;
using IGlobalist.Cms.Bll;
using IGlobalist.Cms.Model;


namespace IGlobalist.Cms.Admin.Control
{
    public partial class OrderView : AdminBaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void DoBindOrder(object sender, EventArgs e)
        {
            OrderTree ucOrderTree = (OrderTree)sender;
            long orderID = Convert.ToInt64(ucOrderTree.SelectedValue);
            BindOrder(orderID);
        }

        public void BindOrder(long orderID)
        {
            IOrder order = OrderController.GetOrder(orderID);
            lblOrderCreated.Text = order.CreatedDate.ToString();
            lblOrderStatus.Text = order.OrderStatus.ToString();
            lblOrederComment.Text = order.OrderComments;

            lbOrderName.Text = order.Name;
            lblAddress1.Text = order.ShippingAddress1;
            lblAddress2.Text = order.ShippingAddress2;
            lblCity.Text = order.ShippingCity;
            lblCountry.Text = order.ShippingCity;
            lblState.Text = order.ShippingState;

            IList<IOrderLine> list = new List<IOrderLine>();
            foreach (IOrderLine o in order.OrderLineList)
                list.Add(o);
            gvProducts.DataSource = list;
            gvProducts.DataBind();

        }

        public void DoShow(object sender, EventArgs e)
        {
            this.Visible = true;
        }

    }
}